#include <GL/glut.h>
#include <stdio.h>
#include <math.h>

#include "plotter.h"
#include "function.h"

#include <iostream>
#include <string>

#include <cmath>
#include <vector>
#include <map>

using namespace std;


struct Point2d
{
	Point2d(double x, double y) : x(x), y(y) {}

	double x, y;
};


int main ( int argc, char** argv ) 
{
	Plotter *p = Plotter :: instance();
	int num;
	cout << "Enter number of functions \n";
	cin >> num;
    string funct;
	string color;
    Function *fun;
	PlotParams params;
	
	std::map< string, PlotParams > m;
	m["red"]	= PlotParams(1,0,0);
	m["green"]	= PlotParams(0,1,0);
	m["blue"]	= PlotParams(0,0,1);

    for (int i = 0; i < num; ++i)
    {
		cout << "Enter function \n";
		cin >> funct;
		fun = Build (funct);
		

		while(true)
		{
			cout << "Enter color: red, green, blue \n";
			cin >> color;

			std::map< string, PlotParams > :: const_iterator 
				it = m.find(color);
			
			if (it != m.end())
			{
				params = it->second;
				break;
			}
			cout << "Incorrect color. Please try again.\n";
		}

		p->drawFuction(fun, -5, 5, params);
	}
	p->run();
}